package com.weiqiao.report.distributior.repository.impl;

import com.weiqiao.base.dao.impl.BaseMongoDaoImpl;
import com.weiqiao.report.distributior.repository.IAccountDetailReportRepository;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("AccountDetailReportRepositoryImpl")
public class AccountDetailReportRepositoryImpl extends BaseMongoDaoImpl implements IAccountDetailReportRepository {

    private String collectionName = "app_user_account_detail_";

    @Override
    public String findOneAccountDetail(int company_id, Bson filter) {
        return this.findOne(collectionName + company_id, filter);
    }

    @Override
    public boolean updateDetail(Document doc, Bson filter, int company_id) {
        return this.updateMany(collectionName + company_id, filter, doc, false);
    }

    @Override
    public int countNum(int company_id, Bson delete_flag) {
        return this.statististics(collectionName + company_id, delete_flag);
    }

    @Override
    public List<String> getAccountDetailByFilterSortLimit(int company_id, Bson filter, Bson sort, int skip, int limit) {
        List<String> list = this.findFilterSortSkipLimit(collectionName + company_id, filter, sort, skip, limit);
        return list;
    }

    @Override
    public List<String> getList(int company_id, Bson filter) {
        return super.findFilter(collectionName + company_id, filter);
    }

    @Override
    public boolean insertOne(int company_id, String json) {
        return super.inSert(collectionName + company_id, json);
    }
}
